unit UNormalGravity;

interface

uses SysUtils, Windows, Classes, Math, UMapObjekte, UPictureName, UPlayer;

type
  TNormalGravity = class(TMapObject) // 13
  private
  public
    constructor Create(Id: integer); Override;
    function getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
      Override;
  end;

implementation

uses UGame;
{ TNormalGravity }

constructor TNormalGravity.Create(Id: integer);
begin
  self.Id := Id;
  self.Num := 13;
  FPictureName := b_Gravity_Normal;
end;

function TNormalGravity.getCollisionAtPixel(Game: TObject; X, Y: integer)
  : integer;
var
  vgame: TGame;
begin
  vgame := Game as TGame;
  if ((vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = RGB(250, 0, 250)) or
      (vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = -1)) then
    result := 0
  else
    result := 6;
end;

end.
